<?php
require("phpmailer/class.phpmailer.php");
$mail = new PHPMailer();   //实例化
$mail->IsSMTP();                 // 启用SMTP
$mail->Host="smtp.163.com";      //smtp服务器的名称（这里以126邮箱为例）
$mail->SMTPAuth = true;         //启用smtp认证
$mail->Username = "";   //你的邮箱名
$mail->Password = "test.com";      //邮箱密码
$mail->From = "";            //发件人地址（也就是你的邮箱地址）
$mail->FromName = "";              //发件人姓名
$mail->AddAddress("","收件人姓名"); //添加收件人
$mail->AddReplyTo("");    //回复地址(可填可不填)
$mail->WordWrap = 50;                    //设置每行字符长度
$mail->AddAttachment("images/01.jpg", "manu.jpg");   // 添加附件,并指定名称
$mail->IsHTML(true);                 // 是否HTML格式邮件
$mail->CharSet="utf-8";    //设置邮件编码
$mail->Subject = "Hello";          //邮件主题
$mail->Body    = '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN" lang="zh-CN">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
	<title>model</title>
	<meta http-equiv="Content-language" content="zh-CN" />
	<style type="text/css" media="all">
	</style>
</head>
<body>
<div id="page">
<span style="color:red;">Test Email~</span>
</div><!-- #page end! -->
<script type="text/javascript">
//<![CDATA[
//]]>
</script>
</body>
</html>
	';        //邮件内容
$mail->AltBody = "This is the body in plain text for non-HTML mail clients"; //邮件正文不支持HTML的备用显示
if(!$mail->Send()) {
	echo "Message could not be sent. <p>";
	echo "Mailer Error: " . $mail->ErrorInfo;
	exit();
} else {
	echo "Message has been sent";
}
